package bbc;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class aaas {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String s = bf.readLine();
        int k = Integer.parseInt(bf.readLine());
        String s1 = find(s, k);
        System.out.println(s1);

    }
    public static String find(String str,int num){
        if(num == 0){
            return str;
        }
        if(num == str.length()){
            return "0";
        }
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        String temp = String.valueOf(arr,arr.length-num,num);
        arr = str.toCharArray();
        StringBuilder res = new StringBuilder();
        for(char a:arr){
            if(num <= 0){
                res.append(a);
            }else if(!temp.contains(String.valueOf(a))){
                res.append(a);
            }else{
                num --;
            }
        }
        return res.toString();
    }

}
